
//背景图
$(function () {
    var flag = true;
    var img_current_BgImage;

    function backgroundImage() {
        var img_path = "../images/home/";
        var img_num = 20;

        var img_current_num = function () {
            return Math.floor(Math.random() * img_num + 1);
        };

        var img_url = function () {
            return img_path + "bg_" + img_current_num() + ".jpg";
        };

        img_current_BgImage = img_url();

        $("#homepage").css({backgroundImage: "url(" + img_current_BgImage + ")"});
    }

    backgroundImage();



    //间隔背景
    $("#fengche").on("click", function () {
        backgroundImage();
        $("#fengche").toggleClass("fengcheBtn");
    });

    //显示个人信息
    $("#addButton").on("click", function () {
        $("#homeBook").toggleClass("homeBook-padding");
        $("#addButton").toggleClass("addBtn");
        setTimeout(function(){
            $("#homepage").toggleClass("bgMoveOut");
        },20);
        $("#personality").toggleClass("slideOut");
    });

    //回顶部、清除缓存
    $("#floating").on("click",function(){
        $("#floating").animate({
            bottom: "800px"
        },800,"swing");
        $("#floating").animate({
            bottom: "40px"
        },10);
    });

});